package homework;

public class zy07 {
	public static void main(String[] args) {
		System.out.println(toBinary(8));
	}
	
	public static String toBinary(int decimal) {
        if (decimal == 0) {
            return "0";
        }

        StringBuffer binary = new StringBuffer();
        while (decimal > 0) {
            int remainder = decimal % 2;
            binary.insert(0, remainder);
            decimal = decimal / 2;
        }
        return binary.toString();
    }
}
